<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateNotesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('notes', function (Blueprint $table) {
            $table->id();
            $table->integer('userId', false, true)->comment('用户id');
            $table->integer('questionId', false, true)->comment('题目id');
            $table->string('title')->nullable()->comment('标题');
            $table->text('content')->nullable()->comment('内容');
            $table->tinyInteger('status')->default(1)->comment('状态(1:正常)');
            $table->integer('like')->default(0)->comment('点赞数量');
            $table->timestamps();
        });

        DB::statement("ALTER TABLE notes comment '笔记表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('notes');
    }
}
